using Assets.Scripts.GDK;
using UnityEngine;
using UnityEngine.UI;

namespace Brick
{
	public class itemMake : MonoBehaviour
	{
		public int ID;

		public int type;

		public int typeID;

		public int num;

		public Image image;

		public Text text;

		public Text textID;

		public bool defaultOpen = true;

		public void setID(int n)
		{
			ID = n;
			textID.text = n.ToString();
		}

		public void setNum(int n)
		{
			if (n < 0)
			{
				n = 0;
			}
			num = n;
			text.text = n.ToString();
			if (n == 0)
			{
				text.gameObject.SetActive(value: false);
			}
			else
			{
				text.gameObject.SetActive(value: true);
			}
		}

		public void setImage(Sprite sp)
		{
			image.sprite = sp;
		}

		public void initData(int ctype, int ctypeID)
		{
			type = ctype;
			typeID = ctypeID;
		}

		public void setOpen(bool bOpen)
		{
			defaultOpen = bOpen;
		}

		public void OpenState()
		{
			if (type == 1 && typeID == 5)
			{
				setImage(gdk_game_manager.loadSprite("UI/Brick/tq_brick_5"));
			}
			else if (type == 1 && typeID == 7)
			{
				setImage(gdk_game_manager.loadSprite("UI/Brick/tq_brick_7"));
			}
			else if (type == 1 && typeID == 10)
			{
				setImage(gdk_game_manager.loadSprite("UI/Brick/tq_brick_10"));
			}
		}

		public void CloseState()
		{
			if (type == 1 && typeID == 5)
			{
				setImage(gdk_game_manager.loadSprite("UI/Brick/tq_brick_5B"));
			}
			else if (type == 1 && typeID == 7)
			{
				setImage(gdk_game_manager.loadSprite("UI/Brick/tq_brick_7B"));
			}
			else if (type == 1 && typeID == 10)
			{
				setImage(gdk_game_manager.loadSprite("UI/Brick/tq_brick_5B"));
			}
		}

		public void ResetImage()
		{
			int num = typeID / 5;
			int num2 = typeID % 5;
			string id = "UI/Brick/tq_brick_3_" + num + "_" + num2;
			Sprite sprite = gdk_game_manager.loadSprite(id);
			setImage(sprite);
		}
	}
}

